package spring.cloud.tasks.executor.name_space.executor.tasks_runtime_info.task_item_execute;

import java.util.concurrent.ConcurrentHashMap;

public class TaskExecuteRuntimeContext {
    /**
     * 如果不允许多实例存在 那么实例id为root，如果存在则是具体的实例id
     */
    public static ConcurrentHashMap<String, TaskInstanceExecuteRuntimeContext> taskInstanceIdToTaskInstanceExecuteRuntimeContextMap = new ConcurrentHashMap<String, TaskInstanceExecuteRuntimeContext>();

    public TaskInstanceExecuteRuntimeContext getTaskInstanceExecuteRuntimeContext(String taskInstanceId) {
        taskInstanceIdToTaskInstanceExecuteRuntimeContextMap.put(taskInstanceId, new TaskInstanceExecuteRuntimeContext());
        TaskInstanceExecuteRuntimeContext taskInstanceExecuteRuntimeContext = taskInstanceIdToTaskInstanceExecuteRuntimeContextMap.get(taskInstanceId);
        return taskInstanceExecuteRuntimeContext;
    }
}
